<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:rg="http://www.ruijie.com.cn/faces/ui"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	template="/layout/contentLayout.xhtml">

	<ui:param name="param_pageTitle"
		value="#{messages.luyuan_crm_menu_order}" />
	<ui:param name="param_navigationUrl"
		value="/luyuan/sale/layout/navigationSale.jsf" />

	<ui:define name="road">
		<span><h:outputLink value="/luyuan/sale/orderListForSale.jsf">我的订单</h:outputLink> &gt;&gt; 新建订单 </span>
	</ui:define>

	<!-- content -->
	<ui:define name="content">
		<rg:areaPanel id="questionTable">
			<rg:wizardPanel id="orderWizard">
				<rg:areaPanel>
					<rg:titlePanel id="memberInfo" headerTitle="会员信息">
						<rg:fieldSet column="double">
							<rg:outputText value="#{orderWizardAction.customer.name}" id="memberName" label="姓名" />
							<rg:outputText value="#{orderWizardAction.customer.mobile}" id="memberPhone" label="联系电话" 
								validator="#{customerMoblieValidator}"/>
		                    <rg:field label="出生年月">
		                    	<rg:datetime value="#{orderWizardAction.customer.birthDate}" datePattern="yyyy-MM-dd" />
		                    </rg:field>
							<rg:inputText value="#{orderWizardAction.customer.nativePlace}" label="籍贯" id="nativePalce" />
		                    <rg:selectOne id="gender"  required="true"  label="姓别" value="#{orderWizardAction.customer.gender}" 
		                    	converter="#{genderConverter}" itemsProvider="#{genderProvider}"/>
							<rg:inputText value="#{orderWizardAction.customer.qq}" label="QQ" id="qq" />
		                    <rg:field id="address" label="常住地址"  singleLine="true">
		                    	<h:selectOneMenu id="province" value="#{orderWizardAction.customer.address.province}" styleClass="select" 
		                    		onchange="jQuery('#orderWizard_form\\:city').val(null);jQuery('#orderWizard_form\\:region').val(null);">
                   					<f:selectItem itemLabel="请选择省"/>
		                    		<f:selectItems value="#{provinceProvider.getSelectItems(null)}" />
		                    	</h:selectOneMenu>
		                    	<h:selectOneMenu id="city" value="#{orderWizardAction.customer.address.city}"  styleClass="select" 
		                    		onchange="jQuery('#orderWizard_form\\:region').val(null);">
                   					<f:selectItem itemLabel="请选择市"/>
		                    		<f:selectItems value="#{cityProvider.getSelectItems(orderWizardAction.customer.address.province)}" />
	                    			<rg:reference for="province" actionListener="#{param_action.onProvinceChange}"  eventsQueue="address"/>
		                    	</h:selectOneMenu>
		                    	<h:selectOneMenu id="region" value="#{orderWizardAction.customer.address.region}" styleClass="select" >
                   					<f:selectItem itemLabel="请选择区（县）"/>
		                    		<f:selectItems value="#{regionProvider.getSelectItems(orderWizardAction.customer.address.province,orderWizardAction.customer.address.city)}" />
	                    			<rg:reference for="province,city" actionListener="#{param_action.onCityChange}"  eventsQueue="address"/>
		                    	</h:selectOneMenu>
		                    	<h:inputText id="street" value="#{orderWizardAction.customer.address.street}" styleClass="text" style="width:256px;"/>
		                    </rg:field>
	                    	<rg:inputText id="postCode" label="#{messages.luyuan_member_postCode}" value="#{orderWizardAction.customer.address.postCode}" >
								<rg:reference for="city,region" actionListener="#{orderWizardAction.resetPostCode}"  eventsQueue="address"/>
							</rg:inputText>
		                    <rg:inputText id="height" label="#{messages.luyuan_member_height}" value="#{orderWizardAction.customer.height}"  tip="cm"/>
		                    <rg:inputText id="weight" label="体重" value="#{orderWizardAction.customer.weight}"  tip="kg"/>
						</rg:fieldSet>
					</rg:titlePanel>

					<rg:titlePanel id="memberBaseInfo" headerTitle="会员基本情况">
						<rg:fieldSet>
							<c:forEach var="extMap"
								items="#{orderWizardAction.questionExtendMap}">
								<c:choose>
									<c:when test="#{extMap.key.itemType == 'RADIO'}">
										<rg:field singleLine="false" label="#{extMap.key.item}">
											<h:selectOneRadio value="#{extMap.key.defaultValue}">
												<c:forEach var="op" items="#{extMap.value}">
													<f:selectItem itemLabel="#{op.optionDesc}"
														itemValue="#{op.optionValue}" name="#{extMap.key.name}" />
												</c:forEach>
											</h:selectOneRadio>
										</rg:field>
									</c:when>
									<c:when test="#{extMap.key.itemType == 'TEXT'}">
                                        <rg:inputText value="#{extMap.key.defaultValue}"
                                            id="#{extMap.key.name}" name="#{extMap.key.name}"
                                            label="#{extMap.key.item}" textStyle="width:256px;" />
                                    </c:when>
                                    <c:when test="#{extMap.key.itemType == 'TEXTAREA'}">
                                        <rg:inputArea id="#{extMap.key.name}" textStyle="width:256px;"
                                            label="#{extMap.key.item}" value="#{extMap.key.defaultValue}" />
                                    </c:when>
                                    <c:when test="#{extMap.key.itemType == 'BIGTEXTAREA'}">
                                        <rg:inputArea id="#{extMap.key.name}" textStyle="width:256px;"
                                            label="#{extMap.key.item}" value="#{extMap.key.defaultValue}" />
                                    </c:when>
								</c:choose>
							</c:forEach>

						</rg:fieldSet>
					</rg:titlePanel>

				</rg:areaPanel>

			</rg:wizardPanel>
		</rg:areaPanel>
	</ui:define>
</ui:composition>